package com.ptkc.utils;

import lombok.Data;

import java.util.Date;

/**
 * @author: Mr.Jiao
 * @date: 2019年01月12日
 */
@Data
public class DateRange {

    private Date start;

    private Date end;

    public DateRange(Date start, Date end) {
        this.start = start;
        this.end = end;
    }

    public boolean isRange(Date date){
        if(start == null && end == null){
            return true;
        }else if(start == null && end.compareTo(date) > -1){
            return true;
        }else if(end == null && start.compareTo(date) < 1){
            return true;
        }else {
//            System.out.println(start.compareTo(date));
//            System.out.println(end.compareTo(date));
            return start.compareTo(date) < 1 && end.compareTo(date) > -1;
        }
    }
}
